package businessServlets;

import java.io.IOException;
import java.util.logging.Logger;

import javax.servlet.http.*;

import com.google.appengine.api.images.Image;
import com.google.appengine.api.images.ImagesService;
import com.google.appengine.api.images.ImagesServiceFactory;
import com.google.appengine.api.images.Transform;

import controller.Controller;


@SuppressWarnings("serial")
public class CancelSendToOrderMail extends HttpServlet {
	private static final Logger log = Logger.getLogger(CancelSendToOrderMail.class.getName());
	public void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws IOException {

		System.out.println("%%%%%%%%");
		try{
			int orderID = Integer.parseInt(req.getParameter("orderID"));
			String bizName=req.getParameter("businessName");
			log.warning("bizName: "+bizName);
			System.out.println("##bizName "+bizName);
			System.out.println("##order "+orderID);
			log.warning("order: "+orderID);
			int result = Controller.getInstance().cancelSendToOrderMail(orderID, bizName);
			log.warning("result: "+result);
			switch(result)
			{
			case 0:
				break;
			case 1:
				break;
			}
			
			resp.sendRedirect("/home.jsp");
			
		}
		catch(NumberFormatException e)
		{
//			req.getSession().setAttribute("validErrorNewOrder","order id is not a number");		
			resp.sendRedirect("/home.jsp");
			
		}		 
		
	}
}
